import React from 'react';
import redux from '../_/redux';
import Table, {
    setColumnKeys
} from '../_/table';

@redux("visit", {
    prefix: "pVisit",
    loadArgs: [{Id: "-1"}],
    actions: ['load']
})
export default class visitsRecords extends React.Component {
    componentWillReceiveProps(props) {
        if (props.visitInfo !== this.props.visitInfo) {
            this.props.pVisitload({patientid: props.visitInfo.patientId});
        }
    }
    render() {
        const columns = [{
            title: '科别',
            dataIndex: 'visitDept',
        }, {
            title: '门诊流水号',
            dataIndex: 'SerialNumber',
        }, {
            title: '医师',
            dataIndex: 'doctor',
        }, {
            title: '就诊日期',
            dataIndex: 'visitDate',
        }];
        setColumnKeys(columns);
        const {pVisitdata = []} = this.props;
        const dataSource = pVisitdata;
        return (<div className="w100 padding-t">
            <Table
                columns={columns}
                dataSource={dataSource}
                pagination={false}
                {...this.props}
            />
        </div>);
    }
}
